option(BUILD_GLSALSVIEWER OFF)
if(BUILD_GLSALSVIEWER)
#---------------------------------------------------------------
#---------------------------------------------------------
#  Find dependencies librairies
#--------------------------------------------------------
find_package(OpenGL REQUIRED)
if(OPENGL_FOUND)
                message(STATUS "OpenGL FOUND ")
                include_directories( ${OPENGL_INCLUDE_DIR} )
else(OPENGL_FOUND)
                # For convenience. inform the user
                message(FATAL_ERROR "OpenGL NOT FOUND ")
endif(OPENGL_FOUND)

find_package(GLUT REQUIRED)
if(GLUT_FOUND)
                message(STATUS "GLUT FOUND ")
                include_directories( ${GLUT_INCLUDE_DIR} )
else(GLUT_FOUND)
                # For convenience. inform the user
                message(FATAL_ERROR "GLUT NOT FOUND ")
endif(GLUT_FOUND)

find_package(wxWidgets COMPONENTS base core gl aui REQUIRED)
if(wxWidgets_FOUND)
         message(STATUS "wxWidgets FOUND ")
                include (${wxWidgets_USE_FILE})
else(wxWidgets_FOUND)
       # For convenience. inform the user
       message(FATAL_ERROR "wxWidgets NOT FOUND ")
endif(wxWidgets_FOUND)

#----------------------------------------------------------
# add executbale
#----------------------------------------------------------
set(glAlsViewer_DIR ${CMAKE_CURRENT_SOURCE_DIR})
add_executable (glAlsViewer 
                          ${glAlsViewer_DIR}/Interface.cpp
                          ${glAlsViewer_DIR}/DonneesAscii.cpp
                          ${glAlsViewer_DIR}/trackball.c
                          ${glAlsViewer_DIR}/Interface.h
                          ${glAlsViewer_DIR}/DonneesAscii.h
                          ${glAlsViewer_DIR}/trackball.h
                          ${glAlsViewer_DIR}/openAlsFileDialog.h
                          ${glAlsViewer_DIR}/openAlsFileDialog.cpp
                          ${glAlsViewer_DIR}/glCanvas.h
                          ${glAlsViewer_DIR}/glCanvas.cpp
                          ${glAlsViewer_DIR}/glAlsViewer.h
                          ${glAlsViewer_DIR}/glAlsViewer.cpp
                          ${glAlsViewer_DIR}/glFrame.h
                          ${glAlsViewer_DIR}/glFrame.cpp
                          )

target_link_libraries(glAlsViewer luttinyxml liblutcore liblutwx
       ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${wxWidgets_LIBRARIES})
set_target_properties(glAlsViewer  PROPERTIES
 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
#---------------------------------------------------------------
#---------------------------------------------------------------
endif(BUILD_GLSALSVIEWER)
